/*!
 * TidyBlog 2.0
 * Article create & edit page - v1.0 (2013-10-06T11:34:22+0800)
 * https://code.google.com/p/tidyblog/ | Released under MIT license
 */
define(function(require, exports, module) { 'use strict';

var $ = require('dom/1.0.x/'),
	Validator = require('validator/1.0.x/'),
	util = require('/common/util/1.0.x/')
	KindEditor = window.KindEditor;

var editor;
KindEditor.ready(function(K) {
	editor = K.create('#Content', {
		cssPath: "/Content/pub.css",
		bodyClass: 'article-content',
		basePath: '/KindEditor/',
		uploadJson: '/Manage_Article/Upload',
		fullscreenShortcut: false,
		items: [
			'formatblock', 'fontsize', '|',
			'forecolor', 'hilitecolor', 'bold', 'italic', 'underline', 'strikethrough', 'subscript', 'superscript', '|',
			'link', 'unlink', '|', 'justifyleft', 'justifycenter', 'justifyright', 'justifyfull','indent', 'outdent', '|',
			'insertorderedlist', 'insertunorderedlist', '|', 'image', 'flash', 'insertfile', 'table', 'hr', 'code', '|',
			'fullscreen', 'source'
		]
	});
});

new Validator({
	form: $('form'),
	steps: [
		{ fields: 'Title', message: '标题不能为空' },
		{ fields: 'CategoryId', message: '请选择分类' },
		{ fields: 'Weight', rule: 'min:0&&max:255', message: '权重必须为0-255' },
		{ fields: 'SummarySize', rule: 'min:0&&max:9999', message: '摘要长度必须为0-9999' },
		{ fields: 'State', message: '请选择文章状态' }
	],
	events: {
		submiterror: util.onSubmitError
	}
});

});